<?php
	global $res, $queryData, $DEV_TESTI_SUBMIT_VERIFICATION, $DEV_TESTI_SENDER, $DEV_TESTI_LABEL,$DEV_TESTI_DATE_SENT;
	(is_numeric($res[1])) ? $page = strip_tags($res[1]) : $page = 1;
	$numrec = NUMREC;
	$perpage = PAGE;	//jumlah record yang ditampilkan perhalaman
	$defshow = DEFSHOW;
	if ($page!=0)
		$piro=($page-1)*$perpage;
	else
		$piro = 0;
		
	(is_numeric($res[3])) ? $extendQuery = "tipe='testimonial-".$res[3]."'" : $extendQuery = "tipe='testimonial'";
		
	if (isset($_SESSION['sesi_ver'])) {
		$_SESSION['sesi_ver'] = $DEV_TESTI_SUBMIT_VERIFICATION;
?>
      <div align="left">
      	<div align="left">
          <table border="0" align="center" cellpadding="0" cellspacing="4">
          <tr>
            <td></td>
            <td><?php echo "<div id=\"sesi_confirm\">".$_SESSION['sesi_ver']."</div>"; unset($_SESSION['sesi_ver']);?></td>
            <td></td>
          </tr>
        </table>
        </div></div>
<?php
	}
?>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <th height="30" colspan="2" class="imagesSUB"> <div align="center"><?php echo $DEV_TESTI_LABEL; ?></div></th>
    <th width="100" nowrap class="imagesSUB"> <div align="center"><?php echo $DEV_TESTI_DATE_SENT; ?></div></th>
  </tr>
  <?php	
	$sql1 = "SELECT * FROM tbl_content WHERE ".$extendQuery." AND status='1' ORDER BY tanggal DESC";
	$x = 1;
	$num = 1;
	$qry1 = mysql_query($sql1);
	while ($row1 = mysql_fetch_object($qry1)) {
		$kk1[$numrec] = $row1->idx;
		$numrec++;
	}
	$divpage = $queryData->showpage('index.php',$numrec,$defshow,$perpage,$page,'testimonial');
	
	for ($i=$piro;$i<($piro+$perpage);$i++) {
		$cc = $kk1[$i];
		if ($cc!="") {
			$row1 = $queryData->selek1("tbl_content",$extendQuery." AND idx='".$cc."'");
			$dataexpl = explode('#',$row1->header_c);
			$ipaddress = $dataexpl[0];
			$email = $dataexpl[1];
			$sender = $dataexpl[2];
			$website = $dataexpl[3];
			$data = $x % 2;
			$image = md5($dataexpl[1]);
			if (defined('USE_GRAVATAR')) {
				$str = file_get_contents('http://www.gravatar.com/'.$image.'.php');
				$profile = unserialize($str);
				if (is_array($profile) && isset( $profile['entry']))
					$title = $profile['entry'][0]['displayName'];
				else
					$title = "No Name";
				$gambar = '<a rel="lyteframe" title="Profile: '.$title.'" rev="width: 600px; height: 500px; scrolling: auto;" href="'.DIR_PATH.'gravatar.php?id='.$image.'"><img src="http://www.gravatar.com/avatar/'.$image.'" width="32" /></a>';
			} else {
				$gambar = '<img src="http://'.$_SERVER['HTTP_HOST'].DIR_PATH.'images/panah.gif">';
			}
			($data==0) ? $dataX = "ganjil" : $dataX = "genap"; 
?>
  <tr valign="top" class="<?php echo $dataX; ?>">
    <td width="32" align="left"><div align="left" class="imagegravatar"><?php echo $gambar; ?></div></td>
    <td nowrap><div align="left"><div class="author"><?php echo $DEV_TESTI_SENDER.": "; ?><?php echo $sender; ?></div><div class="commentsbox"><?php echo substr($row1->isi,0,500); ?></div></div></td>
    <td align="left" nowrap="nowrap"><div class="author"><?php echo $queryData->tanggalan($row1->tanggal); ?></div></td>
  </tr>
<?php
			$x++;
			$num++;
		}
	}
?>
</table>
<div align="center"><?php echo $divpage; ?></div>